home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / a86v400.zip / A03.DOC < prev    next >
Text File  |  1994-12-17  |  23KB  |  508 lines

  1. CHAPTER 3   OPERATION AND REQUIREMENTS
  2.  
  3.  
  4. Creating Programs to Assemble
  5.  
  6. Everything I say about A86 applies equally well to my A386
  7. assembler, whose program name is A386.  The additional features
  8. of A386 consist of the 32-bit register set and additional
  9. instructions and instruction forms, outlined in Chapter 6.  A386
  10. is available only on the registered A86+D86 disk.
  11.  
  12. Before you invoke A86 you must have an assembly-language source
  13. program to assemble.  A source program is an ASCII text file,
  14. created with the text editor of your choice.  The editor must
  15. produce a file that is free of internal records known only to the
  16. editor.  Some of the fancier word processors will require you to
  17. use a "plain text" mode to insure that the file is free of such
  18. records.
  19.  
  20. This manual will fully explain to you the correct syntax of an
  21. A86 program, but it is not intended to teach you about the
  22. 86-family instruction set, or about assembly-language interfacing
  23. to your computer or your operating system.
  24.  
  25. The instruction set charts in Chapters 6 and 7 give concise,
  26. one-line descriptions of each instruction, but they don't go into
  27. any detail about instruction usage, or about how to make system
  28. calls to input from keyboard or disk, output to screen, printer
  29. or disk, etc.  For that, you need a book that covers the MS-DOS
  30. operating system and the BIOS for the IBM-PC.  I am currently
  31. using DOS Programmer's Reference by Terry Dettmann, available by
  32. mail from Public Brand Software at 1-800-426-3475.  At a more
  33. instructional level, my users report that Peter Norton's Assembly
  34. Language Guide to the IBM-PC has been helpful.
  35.  
  36.  
  37. Program Invocation
  38.  
  39. To invoke A86, you must provide a program invocation line, either
  40. typed to the console when the DOS command prompt appears, or
  41. included in a batch file.  The program invocation line consists
  42. of the program name A86, followed by assembler switches
  43. (described in the next section), and the names of the source
  44. files you want to assemble, and of the output files you want to
  45. produce.  If the output files all have their standard extensions,
  46. they may appear in any order: before, after, or even intermixed
  47. with the source file names.  If they don't have their standard
  48. extensions, you must give the source file names first, followed
  49. by the word TO, followed by the output file names.  Each
  50. non-standard name following the word TO will be assigned to the
  51. first previously- unassigned output file in order: program,
  52. symbols, listing, then cross-reference.
  53.  
  54. You may use the wild card delimiters * and ? if you wish, to
  55. denote a group of source files to be assembled.  A86 will sort
  56. all matching names into alphabetical order for each wild card
  57. specification; so the files will be assembled in the same order
  58. even if they get jumbled up within a directory.
  59.                                                               3-2
  60.  
  61. If you provide a name without a period or an extension, A86 will
  62. use that as the output program file name, appending to it the
  63. default extension as follows:
  64.  
  65. 1. .OBJ if you invoked the +O switch, for linkable object file
  66.    production.
  67.  
  68. 2. .BIN if there is no +O switch, but there is an ORG 0 of in
  69.    your program, without a later ORG 256.
  70.  
  71. 3. .COM otherwise.
  72.  
  73. If you want your program file to have no extension, you end the
  74. file name with a period.
  75.  
  76. You may omit any of the output file names if you wish.  If you do
  77. so, A86 will output the program source.COM (or source.OBJ or
  78. source.BIN), where "source" is a name derived from the list of
  79. source files, according to the rules described in the section
  80. "Strategies for Source File Maintenance" later in this chapter.
  81. Any of the other output files will use the name of the program
  82. output file, combined with the standard extension for that output
  83. file.
  84.  
  85.  
  86. Assembler Switches
  87.  
  88. In addition to input and output file names, you may intersperse
  89. assembler switch settings anywhere after the A86 program name.
  90. They are all acted upon immediately, no matter where they are on
  91. the command line.  Some of the switches are discussed in more
  92. detail elsewhere; I'll summarize them here:
  93.  
  94. +C     causes the assembler to output symbol names with lower
  95.     case letters to its OBJ and SYM files.  The case of letters
  96.     is still ignored during assembly.  I output the name as it
  97.     appears in the last PUBLIC or EXTRN directive containing it;
  98.     if there is no such directive, I use the first occurrence of
  99.     the symbol to control which letters are output lower case.
  100.     (+C duplicates Microsoft MASM's /mx switch.)
  101.  
  102. +c     causes the assembler to consider the case of letters
  103.     within all non-built-in symbols as significant both during
  104.     assembly and for output.  Thus, for example, you can define
  105.     different symbols X and x.  (+c duplicates MASM's /ml
  106.     switch.)
  107.  
  108. +D     causes the default base for numeric constants to be
  109.     decimal, even if the constants have leading zeroes.
  110.  
  111. -D     causes the default base to be hexadecimal if there is a
  112.     leading zero; decimal otherwise.
  113.  
  114. +E     causes the error-message-augmented source file to be
  115.     written to yourname.ERR within the current directory, in all
  116.     cases. With +E, A86 will never rewrite your original source
  117.     file.
  118.                                                               3-3
  119.  
  120. -E     causes A86 to insert error messages into your source file,
  121.     whenever the file is in the current directory.  If the file
  122.     is not in the current directory, A86 writes an ERR file no
  123.     matter what the E switch setting is.
  124.  
  125. +F     causes A86 to generate the 287 form of floating point
  126.     instructions (no implicit FWAIT bytes are generated before
  127.     the instructions).  This mode can also be specified in the
  128.     program with the .287 directive.
  129.  
  130. +f     causes A86 to support emulation of the 8087.  When A86
  131.     sees a floating point instruction, it generates external
  132.     references to be resolved by the standard emulation library
  133.     (provided by Microsoft, Borland, etc.).  When you LINK your
  134.     program to the emulation library, the floating point
  135.     instructions are emulated by software.  NOTE you must be
  136.     assembling to a linkable OBJ file for this mode to have
  137.     effect; otherwise, +f is ignored.
  138.  
  139. -F     causes emulation and default-287 to be disabled.  You'll
  140.     still get 287 generation if there is a .287 directive in your
  141.     program.
  142.  
  143. +G  n         causes A86 to implement one or more of the
  144.     following minor options for code-generation.  All these
  145.     options enhance MASM compatibility.  The first three do so at
  146.     the expense of program size.  The number n should be the sum
  147.     of the numbers for each of the options selected.  For
  148.     example, +G10 will select the options numbered 2 and 8.
  149.  
  150.     1    causes A86 to generate a longer (3-byte) instruction
  151.         form for an unconditional JMP instruction to a forward
  152.         reference local label, e.g. JMP >L1.  A86 normally
  153.         assumes that since it's a local label, it will be nearby
  154.         and the short, 2-byte form will work.  With this option
  155.         your code will usually be longer than necessary, but
  156.         you'll be spared having to occasionally go back and code
  157.         an explicit JMP LONG >L1.
  158.  
  159.     2    causes A86 to refrain from optimizing the LEA
  160.         instruction. Without this option A86 will replace an LEA
  161.         with a shorter, equivalent MOV when it sees the chance.
  162.  
  163.     4    causes A86 to generate a slightly more inefficient
  164.         internal format for memory references within an OBJ file.
  165.         The Power C compiler's MIX utility requires the
  166.         inefficient form. The makers of Power C refused to
  167.         support their customers on this by enhancing MIX, so I am
  168.         forced to offer this option.
  169.  
  170.     8    causes A86 to assume that all ambiguous forward
  171.         reference operands to instructions other than jumps or
  172.         calls refer to memory variables and not offsets or
  173.         constant values.  You can override this on a one-by-one
  174.         basis, with the OFFSET operator.
  175.